<?php  

	include('cms.php');
	
	Cms::nocache();
	
	Session::must();

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Edit Content</title>
<link rel="stylesheet" type="text/css" href="css/custom-theme/jquery-ui-1.8.1.custom.css"/>
<link rel="stylesheet" type="text/css" href="css/cms.css"/>
<link rel="stylesheet" type="text/css" href="css/editor.css"/>
<script type="text/javascript" src="strings.php?js"></script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.1.custom.min.js"></script>
<script type="text/javascript" src="js/editor.js"></script>
<script type="text/javascript">
	var myLevel = '<?=Session::level()?>'; //This is just for display
</script>
</head>
<body>
	<form>
	<div id="top">
    	<div class="toolbar">
        	<button class="start ui-corner-all"></button>
        	<button><div class="icon icon-new"></div></button>
            <button><div class="icon icon-open"></div></button>
            <button><div class="icon icon-save"></div></button>
            <div class="separator"></div>
            <button><div class="icon icon-undo"></div></button>
            <button><div class="icon icon-redo"></div></button>
            <div class="separator"></div>
            <button><div class="icon icon-bold"></div></button>
            <button><div class="icon icon-italic"></div></button>
            <button><div class="icon icon-underline"></div></button>
            <div class="separator"></div>
            <select style="float:left; margin-top:6px" id="formatting"></select>
            <button><div class="icon icon-clean"></div></button>
            <div class="separator"></div>
            <button><div class="icon icon-left"></div></button>
            <button><div class="icon icon-center"></div></button>
            <button><div class="icon icon-right"></div></button>
            <div class="separator"></div>
            <button><div class="icon icon-ol"></div></button>
            <button><div class="icon icon-ul"></div></button>
            <div class="separator"></div>
            <button><div class="icon icon-indent"></div></button>
            <button><div class="icon icon-outdent"></div></button>
            <div class="separator"></div>
            <button><div class="icon icon-link"></div></button>
            <?php
            	if(Session::admin()){
					echo '
					<div class="separator"></div>
	            	<button><div class="icon icon-user"></div></button>';
				}
			?>
        </div>
    </div>
    <div id="fill">
    	<div id="editor" CONTENTEDITABLE><p>&nbsp;</p></div>
    </div>
    <div id="tabs">
    	<ul>
            <li><div class="icon icon-properties"></div></li>
            <li><div class="icon icon-file"></div></li>
            <li><div class="icon icon-comment"></div></li>
            <li><div class="icon icon-history"></div></li>
        </ul>
    </div>
    <div id="properties">
    	<div style="padding:0 1.5em; overflow:auto">            
            <div id="lblContent" class="formSeparator"></div>
            <input type="hidden" id="id" />
            <div id="lblTitle"></div>
            <input type="text" id="title"/>
            <div id="lblIntro"></div>
            <textarea id="intro"></textarea>
            <div id="lblSecurity" class="formSeparator"></div>
            <div class="half"><input type="checkbox" id="online" /><label for="online" id="lblOnline"></label></div>
            <div class="half"><input type="checkbox" id="comments" /><label for="comments" id="lblAllowComments"></label></div>
            <div class="half"><input type="checkbox" id="sexybar" /><label for="sexybar" id="lblSexy"></label></div>
            <div class="half"><input type="checkbox" id="rating" /><label for="rating" id="lblAllowRating"></label></div>
            <div id="lblLevel" class="formSeparator"></div>
            <div id="lblReadLevel" class="half"></div>
            <input type="text" id="readlevel" class="half"/>
            <div id="lblEditLevel" class="cleaner half"></div>
            <input type="text" id="editlevel" class="half"/>
            <div id="lblDates" class="formSeparator"></div>
            <div id="lblCreated" class="cleaner half"></div>
            <input type="text" id="created" readonly="readonly" class="half" />
            <div id="lblModified" class="cleaner half"></div>
            <input type="text" id="modified" readonly="readonly" class="half" />
        </div>
    </div>
    <div id="attachments"></div>
    <div id="comments-tab"></div>
    <div id="history"></div>
    <div id="statusbar"><a class="preview selected">Preview</a><a class="html">HTML</a><div></div></div>
    </form>
    <div id="fileDialog" title="Open existing content">
    	<div class="toolbar">
        	<a><div class="icon icon-back"></div></a>
        	<a><div class="icon icon-newfolder"></div></a>
        </div>
    	<table width="100%" cellpadding="3" cellspacing="0"></table>
        <div id="dialogCommands" align="right"><button id="btnChooseCategory"></button></div>
    </div>
    <div id="menu" class="ui-corner-all">
    	<div id="menu-in">
        	<ul id="menu-left">
            	<li><div class="icon-32 icon-new-32"></div><label></label></li>
                <li><div class="icon-32 icon-open-32"></div><label></label></li>
                <li><div class="icon-32 icon-save-32"></div><label></label></li>
                <li><div class="icon-32 icon-saveas-32"></div><label></label></li>
                <li><div class="icon-32 icon-savename-32"></div><label></label></li>
            </ul>
        	<ul id="menu-right"></ul>
            <div class="cleaner"></div>
        </div>
        	<ul id="menu-bottom">
                <li class="logout"></li>
            </ul>
    </div>
<?php

	if(file_exists('../cms-data/ext/.')){
		foreach (new DirectoryIterator('../cms-data/ext/.') as $fileInfo) {
			if(!$fileInfo->isDot() && $fileInfo->isDir()){
				if(file_exists('../cms-data/ext/' . $fileInfo->getFileName() . '/moka-cms.js')){
					echo '<script type="text/javascript" src="' . '../cms-data/ext/' . $fileInfo->getFileName() . '/moka-cms.js' . '"></script>' . "\n";
				}
			}
		}
	}

?>
</body>
</html>